home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MENU_UTL / PULL70B / P70-VAR.INC < prev    next >
Text File  |  1993-09-24  |  10KB  |  297 lines

  1. { ========================================================================== }
  2. { P70-var.inc - Variables for multi-level pull-down menus Ver 7.0b, 09-24-93 }
  3. {                                                                            }
  4. { This file contains all the variables needed for PULL70B.TPU.  You cannot   }
  5. { change this file unless you have the complete PULL70B.PAS source code.     }
  6. {   Copyright (c) 1988,1993 James H. LeMay, All rights reserved.             }
  7. { ========================================================================== }
  8.  
  9. { ================== Data Structure Configuration Constants ================ }
  10. const
  11.   NumOfMainMenus   =   8;    { 1 - 255 }
  12.   NumOfSubMenus    =   5;    { 1 - 255 }
  13.   MaxMenuLines     =  15;    { For Main and Sub menus }
  14.   MaxCharsPerLine  =  21;    { For Main and Sub menus, and Data Window titles}
  15.                              { Be sure to allow for the '~' character. }
  16.  
  17.   NumOfDataWndws   =  16;    { 1 - 255 }
  18.   NumOfDataEntries =  10;    { 1 - 255 }
  19.   DataStrSize      = 100;    { Max chars in data entry string }
  20.  
  21.   NumOfHelpWndws   =  14;    { 1 - 255 }
  22.   TotalHelpLines   =  89;    { 1 - 65535 }
  23.   HelpCharsPerLine =  50;    { 1 - Screen limit }
  24.  
  25.   NumOfMsgLines    =  11;    { 1 - 255 }
  26.   CrtStrSize       =  80;    { Screen limit for sizing strings }
  27.   NumOfErrMsgLines =   7;    { 1 - 65535 }
  28.   ErrStrSize       =  60;    { Error messages are usually short }
  29.   MsgStrSize       =  CrtStrSize+16; { Screen width plus '~' characters }
  30.  
  31. { ========================= Declarations for Menus ========================= }
  32. type
  33.   MenuModeType   = (ExecChoice, SingleChoice, MultipleChoice);
  34.   LineModeType   = (Choice, ExecOnly, NoChoice, Comment, Partition,
  35.                     ToDataWndw, ToSubMenu, ToUserWndw);
  36.   Toggle         = (Off, On, No, Yes);
  37.   CrtStrType     = string[CrtStrSize];
  38.   MsgStrType     = string[MsgStrSize];
  39.   SeqStrType     = string[MaxWndw];
  40.   MenuRec =
  41.     record
  42.       Title:       string[MaxCharsPerLine];
  43.       CmdLtrs:     string[MaxMenuLines];
  44.       Line:        array[1..MaxMenuLines] of string[MaxCharsPerLine];
  45.       LineMode:    array[1..MaxMenuLines] of LineModeType;
  46.       Flagged:     array[1..MaxMenuLines] of boolean;
  47.       LinkNum:     array[1..MaxMenuLines] of byte;
  48.       ProcPtr:     array[1..MaxMenuLines] of procedure;
  49.       ParentDir,
  50.       LinkDir:     DirType;
  51.       MenuMode:    MenuModeType;
  52.       MenuLines:   byte;
  53.       NameCol:     byte;
  54.       NameLen:     byte;
  55.       CmdCol:      byte;
  56.       Row, Col, Rows, Cols:                    byte;
  57.       DefaultLine, HiLiteLine, SingleFlagLine: byte;
  58.       Battr, Wattr, Hattr, Lattr, Cattr:       byte;
  59.       Border:                                  Borders;
  60.       BackToDefault, Changed:                  boolean;
  61.       MsgLineNum, HelpWndwNum:                 byte;
  62.     end;
  63.   MenuRecs = array[1..NumOfMainMenus] of MenuRec;
  64.  
  65. var
  66.   MainMenu:        ^MenuRecs;
  67.   TopMenu:         MenuRec;
  68.   MRI:             word;        { Top menu record index }
  69.   LastMainMenu:    byte;        { <= NumOfMainMenus }
  70.   TopLineStr:      CrtStrType;
  71.   TopLineRow,
  72.   MainMenuRow,
  73.  
  74.   InitAttr,
  75.   TopLineAttr,
  76.   TopLineHattr,
  77.   TopLineLattr,
  78.   MainMenuWattr,
  79.   MainMenuBattr,
  80.   MainMenuHattr,
  81.   MainMenuLattr,
  82.   MainMenuCattr:   byte;
  83.   MainMenuBrdr:    Borders;
  84.  
  85.   Key:             char;
  86.   ExtKey:          boolean;
  87.  
  88.   { -- Control Flags to Pull/Pop the menus. -- }
  89.   PullDown,
  90.   Pop,
  91.   PopToWorkWndw,
  92.   PopToTop,
  93.   PopAndProcess:   boolean;
  94.   PopLevels:       byte;
  95.  
  96.   { -- Variables to indicate location of menus and windows. -- }
  97.   DefaultLinkDir:  DirType;     { Submenus are linked as slide-up
  98.                                   or slide-under by default }
  99.   TopCmdLtrs:      string[NumOfMainMenus];
  100.   CmdSeq,
  101.   MoreCmdSeq:      SeqStrType;  { Sequence of keys pressed. }
  102.   MPulled,
  103.   SPulled,
  104.   HiLited:         byte;
  105.   AccessedWorkWndw,
  106.   AccessedMenus:   boolean;
  107.   WorkWndwStep:    word;
  108.   TopWorkWndwName: WindowNames;
  109.  
  110.   { -- These are addresses for indirect procedure calls out of PULL.TPU -- }
  111.   CallGetUserPullStats,
  112.   CallGetOverrideStats,
  113.   CallCheckGlobalKeys,
  114.   CallWorkWndw,
  115.   CallKbdIdle:     procedure;
  116.  
  117. const
  118.   InWorkWndw:      boolean = true;
  119.   Quit:            boolean = false;
  120.   WaitForKbd:      boolean = true;
  121.  
  122.   { -- Function keys -- }
  123.   HelpKey = #59;    { F1 }
  124.   PopKey  = #60;    { F2 }
  125.   TopKey1 = #68;    { F10 }  { Extended function key }
  126.  
  127.   { -- Data Entry keys -- }
  128.   NullKey  = #00;
  129.   RetKey   = #13;   { ^M }
  130.   BSKey    = #08;
  131.   EscKey   = #27;   { ^[ }
  132.   HomeKey  = #71;
  133.   UpArrKey = #72;
  134.   PgUpKey  = #73;
  135.   LArrKey  = #75;
  136.   RArrKey  = #77;
  137.   EndKey   = #79;
  138.   DnArrKey = #80;
  139.   PgDnKey  = #81;
  140.   InsKey   = #82;
  141.   DelKey   = #83;
  142.   CtrlLArrKey = #115;
  143.   CtrlRArrKey = #116;
  144.   CtrlEndKey  = #117;
  145.   CtrlPgDnKey = #118;
  146.   CtrlHomeKey = #119;
  147.   CtrlPgUpKey = #132;
  148.   TabKey      = #9;
  149.   ShiftTabKey = #15;
  150.  
  151. { ========================= SubMenu Declarations =========================== }
  152. {$ifdef UseSubMenuCode }
  153. type
  154.   SubMenus = array[1..NumOfSubMenus]  of MenuRec;
  155.  
  156. var
  157.   SubMenu:         ^SubMenus;
  158.   LastSubMenu:     byte;        { <= NumOfSubMenus }
  159.   SubMenuWattr,
  160.   SubMenuBattr,
  161.   SubMenuHattr,
  162.   SubMenuLattr,
  163.   SubMenuCattr:    byte;
  164.   SubMenuBrdr:     Borders;
  165.   LocationWarning: boolean;
  166. {$endif }
  167.  
  168. { ====================== Message Line Declarations ========================= }
  169. {$ifdef UseMsgLineCode }
  170. type
  171.   ErrMsgStrType = string[ErrStrSize];
  172.  
  173. const
  174.   CurrentMsgLineNum: word    = 0;   { Index of the message currently shown. }
  175.   EnableKeyStatus:   boolean = true;
  176.  
  177. var
  178.   MsgLine:         array[1..NumOfMsgLines]    of MsgStrType;
  179.   ErrMsgLine:      array[1..NumOfErrMsgLines] of ErrMsgStrType;
  180.   MsgLineRow,
  181.   CapsLockCol,
  182.   ErrMsgAttr,
  183.   KeyStatusAttr,
  184.   MsgLineHattr,
  185.   MsgLineAttr:     byte;
  186. {$endif }
  187.  
  188. { ======================== Help Window Declarations ======================== }
  189. {$ifdef UseHelpWndwCode }
  190. type
  191.   HelpWndwRec =
  192.     record
  193.       FirstLine, LastLine:      byte;
  194.       LinesToShow:              byte;
  195.       Row, Col, Rows, Cols:     byte;
  196.       Battr, Wattr:             byte;
  197.       Border:                   Borders;
  198.       HWmodes:                  byte;
  199.       MsgLineNum:               byte
  200.     end;
  201.  
  202. var
  203.   HelpWndw:        array[1..NumOfHelpWndws] of HelpWndwRec;
  204.   HelpLine:        array[1..TotalHelpLines] of string[HelpCharsPerLine];
  205.   HelpBottomRow,
  206.   HelpWndwModes,
  207.   HelpMsgLineNum,
  208.   HelpWndwWattr,
  209.   HelpWndwBattr:   byte;
  210.   HelpWndwBrdr:    Borders;
  211. {$endif }
  212.  
  213.  
  214. { ======================== Data Windows and Data Entry ===================== }
  215. {$ifdef UseDataEntryCode }
  216. type
  217.   TypeOfDataType = (
  218.     Bytes,Words,ShortInts,Integers,LongInts,Reals,UserNums,Chars,Strings);
  219.   SetNames = (
  220.     NoSet,UnsignedSet,SignedSet,RealSet,CharSet,HexSet,FileNameSet,PathSet,
  221.     MaskSet);
  222.   EntrySetArray  = array[UnsignedSet..MaskSet] of set of char;
  223.   DataEntryRec =
  224.     record
  225.       VarAddr:                  pointer;
  226.       TypeOfData:               TypeOfDataType;
  227.       Row,Col,Field,MaxField:   byte;
  228.       Decimals:                 shortint;
  229.       SetName:                  SetNames;
  230.       TranslateProc,
  231.       CheckRangeProc:           procedure;
  232.       JustifyOutput:            DirType;
  233.       Oattr, Iattr,
  234.       MsgLineNum, HelpWndwNum:  byte;
  235.     end;
  236.   DataWndwRec =
  237.     record
  238.       Title:  string[MaxCharsPerLine];
  239.       DWrow,DWcol: byte;
  240.       Battr:  byte;
  241.       Border: Borders;
  242.       Entry:  DataEntryRec;
  243.     end;
  244.   DataWndws   = array[1..NumOfDataWndws]   of DataWndwRec;
  245.   DataEntries = array[1..NumOfDataEntries] of DataEntryRec;
  246.   DataStrType = string[DataStrSize];
  247.   DataPadRec =
  248.     record
  249.       StoreMode,Valid,DataStored,NewData,PullDW: boolean;
  250.       FieldIndex,CursorOfs,Hattr: integer;
  251.       ErrMsg:  word;
  252.       Flex:    byte;
  253.       Justify: DirType;
  254.       case TypeOfDataType of
  255.         Bytes:        (Bdata:  byte);
  256.         Words:        (Wdata:  word);
  257.         ShortInts:    (SIdata: shortint);
  258.         Integers:     (Idata:  integer);
  259.         LongInts:     (Ldata:  longint);
  260.         Reals:        (Rdata:  real);
  261.         UserNums:     (UNdata: DataStrType);
  262.         Chars:        (Cdata:  char);
  263.         Strings:      (Sdata:  DataStrType);
  264.     end;
  265.  
  266. const
  267.   { -- Filter sets for valid data entry characters -- }
  268.   EntrySet:  EntrySetArray = (
  269.    { -- Reserved sets -- }
  270.    { UnsignedSet: } ['0'..'9'],
  271.    { SignedSet:   } ['0'..'9','-','+'],
  272.    { RealSet:     } ['0'..'9','-','+','.','E','e'],
  273.    { CharSet:     } [' '..'~'],
  274.    { -- User customized sets -- }
  275.    { HexSet:      } ['0'..'9','A'..'F','a'..'f'],
  276.    { FileNameSet: }
  277.      ['!','#'..')','-'..'.','0'..'9','@'..'Z','^'..'{','}'..'~'],
  278.    { PathSet:     }
  279.      ['!','#'..')','-'..'.','0'..':','@'..'Z','^'..'{','}'..'~','\'],
  280.    { MaskSet:     }
  281.      ['!','#'..'*','-'..'.','0'..':','?'..'Z','^'..'{','}'..'~','\']);
  282.  
  283. var
  284.   DWI:             word;        { Top data window record index }
  285.   DEI:             word;        { Top data entry record index }
  286.   TopDataWndw:     DataWndwRec;
  287.   TopEntry:        DataEntryRec;
  288.   DataWndw:        ^DataWndws;
  289.   DataEntry:       ^DataEntries;
  290.   DataStr:         DataStrType;
  291.   DataStrL:        byte absolute DataStr;  { length of DataStr }
  292.   DataPad:         DataPadRec;
  293.   AutoTab,
  294.   AutoNumLock:     boolean;
  295.  
  296. {$endif UseDataEntryCode }
  297.